<?php
/**
* Further'd base of database rows
* 
* @package Smernel
*/
	class _smuoiDbRowExtended extends _smuoiDbRow{
		
		/**
		* whether we are registered to commit on shutdown 
		* @var bool
		*/
		protected $commit_on_shutdown;

		/**
		* see parent
		*/
		function commit($nq=false){
			if(!parent::commit($nq)) return false ;
			$this->post_commit();
			return true;
		}

		/**
		* sets this element to commit edits on exit
		*/
		function commit_on_shutdown(){
			if($this->commit_on_shutdown) return;
			$this->pkg->register_shutdown_commitee($this);
			$this->commit_on_shutdown = true;
		}
		
		/**
		* clears instruction to commit on exit
		*/
		function clear_commit_on_shutdown(){
			if(!$this->commit_on_shutdown) return;
			$this->pkg->unregister_shutdown_commitee($this);
			$this->commit_on_shutdown = false;	
		}
		
		/**
		* post commital procedure
		*/
		protected function post_commit(){
			if(!smuoi_is_exiting()) $this->clear_commit_on_shutdown();
		}
		
	}

